<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.AppConstant" %>
<%@ page import="com.wlcorp.forcazamis.domain.pi.Pidetail" %>
<%@ page import="java.util.List" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.SampleSource" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.SessionValue" %>
<%@ page import="com.wlcorp.forcazamis.sys.permission.PermissionManager" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.CommonUtil" %>

<%
	request.setCharacterEncoding("UTF-8"); 
	Pidetail pidetail = (Pidetail)request.getAttribute("pidetail");
	List sourceList = (List)request.getAttribute("sourceList");
	String creatorName = "";
	if(null != pidetail.getCreator()){
		creatorName = pidetail.getCreator().getStaffName();
	}else{
		creatorName = SessionValue.getInstance(request).getStaff().getStaffName();
	}
	
%>
<html>
<head>
	<title>销售合同编辑</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/validator.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/script/calendartime.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/script/ajax.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/script/dialog.js"></script>
	<script type="text/javascript">
		function doSave(){
			
			//if(!fieldIsNotEmpty(document.forms["pidetailForm"].piCode)){
			//	return;
			//}
			//if(!fieldIsNotEmpty(document.forms["pidetailForm"].customerOgCode)){
			//	return;
			//}
			if(document.forms["pidetailForm"].customerId.value.length < 1){
				alert("请选择客户！");
				return;
			}
			//if(!fieldIsNotEmpty(document.forms["pidetailForm"].outDate)){
			//	return;
			//}
			//if(!fieldIsNotEmpty(document.forms["pidetailForm"].piDate)){
			//	return;
			//}
			//if(!fieldIsNotEmpty(document.forms["pidetailForm"].priceItem)){
			//	return;
			//}
			//if(!fieldIsNotEmpty(document.forms["pidetailForm"].financialCode)){
			//	return;
			//}
			if(!fieldIsNotEmpty(document.forms["pidetailForm"].totalDiscount)){
				return;
			}
			if(!fieldValidateByRegexp(document.forms["pidetailForm"].curExRate,REGEXP_FLOAT)){
				return;
			}
			if(!fieldValidateByRegexp(document.forms["pidetailForm"].totalDiscount,REGEXP_FLOAT)){
				return;
			}
			//if(!chksize(document.forms["pidetailForm"].attach.value)){
			//	return;
			//}
			//if(!fieldIsNotEmpty(document.forms["sampleForm"].source1)){
			//	return;
			//}
			document.forms["pidetailForm"].action="${pageContext.request.contextPath}/pi/pidetailManager.do?method=modifyPidetail";
			document.forms["pidetailForm"].submit();
		}
		function goback(){
			window.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=pidetailManager";
		}
		
		function selectCustomer(){
			var returnValue = window.showModalDialog("${pageContext.request.contextPath}/baseinfo/customerManager.do?method=selectCustomerTop"
				,window,"dialogHeight:400px;dialogWidth:580px;center:yes;help:no;resizable:no;status:no;");
			if(returnValue && null != returnValue){
				document.forms["pidetailForm"].customerId.value = returnValue["customerId"];
				document.forms["pidetailForm"].customerName.value = returnValue["customerName"];
				document.forms["pidetailForm"].linkmanName.value = returnValue["linkmanName"];
				document.forms["pidetailForm"].customerFullName.value = returnValue["customerFullName"];
			}
		}
		
		function piproductDetail(piid){
			window.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=getPiProductList&piid=" + piid;
		}
		
		function pifittingDetail(piid){
			window.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=getPifittingList&piid=" + piid;
		}
		
		function doSubmitConfirm(){
			var sUrl = "${pageContext.request.contextPath}/confirm/confirmManager.do?method=submitConfirm"
				+ "&confirmType=<%=AppConstant.CONFIRM_TYPE_PI%>&itemId=${pidetail.piid}";
			ajaxRead(sUrl,function(obj){
				var result = obj.responseText;
				alert(result);
				document.getElementById("submitConfirmBtn").disabled = true;
			});
		}
		
		function drawbackPI(piid){
			var sUrl = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=drawbackPI&piid=" + piid;
			ajaxRead(sUrl,function(obj){
				var result = obj.responseText;
				alert(result);
				document.getElementById("drawbackBtn").disabled = true;
			});
		}
	
		function setAccount(){
		var account = document.getElementsByName("card");
		var oDiv = document.createElement("DIV");
		var memo=document.getElementById("cardArea");
		var us_account="09-124414040000519";
		var eu_account="09-124438040000039";
		var us_str="<font style='font-weight:bold'>BANK INFORMATION:</font><BR>"+
          			"<font style='font-weight:bold'>BENEFICIARY:</font>  SHANGHAI FORCAZA GLASSES CO.,LTD<BR>"+
          		    "<font style='font-weight:bold'>BENEFICIARY'S BANK:</font>  AGRICULTURAL BANK OF CHINA SHANGHAI BRANCH<BR>"+
          		    "<font style='font-weight:bold'>BENEFICIARY'S ACCOUNT:</font> "+us_account+"<BR>"+
          		    "<font style='font-weight:bold'>SWIFT:</B> ABOCCNBJ";  
        var eu_str="<font style='font-weight:bold'>BANK INFORMATION:</font><BR>"+
          			"<font style='font-weight:bold'>BENEFICIARY:</font>  SHANGHAI FORCAZA GLASSES CO.,LTD<BR>"+
          		    "<font style='font-weight:bold'>BENEFICIARY'S BANK:</font>  AGRICULTURAL BANK OF CHINA SHANGHAI BRANCH<BR>"+
          		    "<font style='font-weight:bold'>BENEFICIARY'S ACCOUNT:</font> "+eu_account+"<BR>"+
          		    "<font style='font-weight:bold'>SWIFT:</font> ABOCCNBJ";  
		var tr = document.getElementById("cardinfo");
        for(var i=0;i<account.length;i++){
         if(account[i].checked){
            var at=account[i].value;
            if(at=="USD"){
               document.getElementById("cardArea").innerText=""; 
          	   oDiv.innerHTML = us_str;
		       memo.appendChild(oDiv);
            }
            if(at=="EUR"){
               document.getElementById("cardArea").innerText="";
               oDiv.innerHTML = eu_str;
		       memo.appendChild(oDiv);
            }
            if(at=="RMB"){
            	document.getElementById("cardArea").innerText="";
            }
          }
         }
		}
		
		function selectPriceItem(){
		var priceItem =document.getElementsByName("priceItemType");
        for(var i=0;i<priceItem.length;i++){
         if(priceItem[i].checked){      
            var at=priceItem[i].value;
          //  alert(at)
            if(at==1){
          		document.getElementById("priceItem").value="FOB SHANGHAI";   
            }
            if(at==2){
          		document.getElementById("priceItem").value="FOB NINGBO";   
            }
            if(at==3){
          		document.getElementById("priceItem").value="CIF";   
            }
            if(at==4){
          		document.getElementById("priceItem").value="OTHER";   
            }
          }
         }
		}
		
		function selectTransportType(){
		var transportType =document.getElementsByName("transportType");
        for(var i=0;i<transportType.length;i++){
         if(transportType[i].checked){      
            var at=transportType[i].value;
          //  alert(at)
            if(at==1){
          		document.getElementById("transportTypeText").value="BY SEA";   
            }
            if(at==2){
          		document.getElementById("transportTypeText").value="BY AIR";   
            }
            if(at==3){
          		document.getElementById("transportTypeText").value="TBD";   
            }
            if(at==4){
          		document.getElementById("transportTypeText").value="WAITING FOR YOUR INFOMATION";   
            }
            if(at==5){
          		document.getElementById("transportTypeText").value="OTHER";   
            }
          }
         }
		}
		
		function printPiDetail(piid){
			window.open("${pageContext.request.contextPath}/pi/pidetailManager.do?method=printPi&piid=" + piid);
		}
		
 		function stockBuild(piid){
 			document.forms["pidetailForm"].action='${pageContext.request.contextPath}/pi/pidetailManager.do?method=stockBuild&piid='+piid+'&random='+Math.random();
 		    document.forms["pidetailForm"].submit();
 		
			   // var df = document.all;
			//	var re = dlgOpen( '选择', '${pageContext.request.contextPath}/pi/pidetailManager.do?method=stockBuild&piid='+piid+'&random='+Math.random(), 600, 500 );
			 //   if( re ) 
			  //  {
			 //       if (re == 'false')
			  //      {
			  //            return;
			  //      }
			      //  var v = re.split( "*" );
			//	df.manufacturerNumber.value=v[0];
				//df.manufacturerName.value=v[1];
			   // }
			   // return false;
	 }
	 
	 function deleteImage(piid){
        	if(!confirm("确定删除？")){
        		return;
        	}
         	var sUrl = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=deleteImage&piid=" + piid
        	ajaxRead(sUrl,function(obj){
        	//document.forms["pidetailForm"].submit();
        		if("" != obj.responseText){
        			 document.getElementById("image").innerHTML="waiting...";
        		     alert("删除成功！");
        		   // window.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=getPidetail&piid=" + piid;
        		}else{
        			alert(obj.responseText);
        		}
        	});
        	window.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=getPidetail&piid=" + piid;
        }
	</script>
	
</head>
<body>
<CENTER>
<form name="pidetailForm" method="POST" encType="multipart/form-data">
<input type="hidden" name="piid" value="${pidetail.piid}"/>
<input type="hidden" name="attachPath" value="${pidetail.attachPath}"/>
<input type="hidden" name="customerId" value="${pidetail.customer.customerId}"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
	<tr> 
	  <td width="22" class="page_titlebar_head">&nbsp;</td>
	  <td class="page_titlebar_bg" width="981">销售合同编辑</td>
	</tr>
</table>

<table width="900" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="table_bgcolor">
      <tr> 
      	<td align="left"> 
      		<input class="button_common" type="button" name="print" value="PI打印档" style="font-size:9pt" onClick="javascript:printPiDetail('<%=pidetail.getPiid()%>')"> 
      	</td>
        <td align="right" valign="middle"> 
          <%
          	if(null == pidetail.getState() || AppConstant.BILL_STATE_SUBMITED == pidetail.getState()){
          %>
          <input class=button_save type=button name=save value="      保存" style="font-size:9pt" onClick="javascript:doSave()" id="btn_submit">
          <%}%>
          
          <%
          	if(null == pidetail.getState() || AppConstant.BILL_STATE_CONFIRMED == pidetail.getState()){
          %>
          <input class=button_build type=button name=stock value="生成采购合同" style="font-size:9pt" onClick="javascript:stockBuild('<%=pidetail.getPiid()%>')" id="btn_submit">
          <%}%>
          
          <input class=button_reset name=reset type=reset value="      恢复" style="font-size:9pt" id="btn_reset">
          <%if(null != pidetail.getPiid()){%>
          <input class="button_common" type=button name="submitConfirmBtn" value="提交审批" style="font-size:9pt" onClick="javascript:doSubmitConfirm()" id="submitConfirmBtn" <%if(AppConstant.BILL_STATE_PRE_CONFIRM == pidetail.getState() || AppConstant.BILL_STATE_CONFIRMED == pidetail.getState() || AppConstant.BILL_STATE_DRAWBACK == pidetail.getState() || null != pidetail.getConfirm()){out.print("disabled");}%>>
          <%}
          	if(null != pidetail.getState() && AppConstant.BILL_STATE_CONFIRMED == pidetail.getState().intValue()){
          %>
          <input class="button_common" type=button name="drawbackBtn" value="退单" style="font-size:9pt" onClick="javascript:drawbackPI('<%=pidetail.getPiid()%>')" id="submitConfirmBtn" >
          <%}%>
          <input type=button name=rst class=button_recovery value="     返回" style="font-size:9pt" onClick="javascript:history.go(-1);" id="btn_recovery">
        </td>
      </tr>
</table>
<table width="900" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
  <tr> 
    <td colspan="4" class="table_unfold_titlebar_small_bg">&nbsp;&nbsp;<b>合同基本信息</b></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="piCode_TEXT">PI编号</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="piCode" value="${pidetail.piCode}" style="width:150px" maxlength="20" readOnly/></td>
		<td class="table_label" width="20%" id="customerOgCode_TEXT">客户定单号</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="customerOgCode" value="${pidetail.customerOgCode}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%">客户号</td>
		<td width="30%">&nbsp;<input name="customerName" class="input" type="text" value="${pidetail.customer.customerName}" style="width:150px" maxlength="20" readOnly/>&nbsp;
		<%
      		if(null == pidetail.getState() || AppConstant.BILL_STATE_SUBMITED == pidetail.getState()){
        %>
		<input type="button" value="选择客户" onclick="selectCustomer()">
		<%}%>
		</td>
		<input type="hidden" name="linkmanName" value="${pidetail.customer.linkmanName}"/>
		<%--
		<td class="table_label" width="20%">客户联系人</td>
		<td width="30%">&nbsp;<input name="linkmanName" class="input" type="text" value="${pidetail.customer.linkmanName}" style="width:150px" maxlength="20" readOnly/></td>
  </tr>
  <tr class="InputFrameLine">
  --%>
        <td class="table_label" width="20%">客户名称</td>
		<td width="30%" colspan="3">&nbsp;<input name="customerFullName" class="input" type="text" value="${pidetail.customer.customerFullName}" style="width:150px" maxlength="20" readOnly/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="outDate_TEXT">出运日</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="outDate" value="${pidetail.outDate}"/></td>
		<td class="table_label" width="20%" id="piDate_TEXT">下单日期</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="piDate" value="${pidetail.piDate}" readonly/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="priceItem_TEXT">价格条款</td>
		<td width="30%">&nbsp;<input class="input" name="priceItem" type="text" value="${pidetail.priceItem}" style="width:150px" maxlength="20"/></td>
		<%--
		<td class="table_label" width="20%" id="financialCode_TEXT">财务号</td>
		<td width="30%">&nbsp;<input class="input" name="financialCode" type="text" value="${pidetail.financialCode}" style="width:150px" maxlength="20"/></td>
  		--%>
  		<input type="hidden" name="financialCode" value="${pidetail.financialCode}"/>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="priceItemType_TEXT">价格条款选项</td>
		<td width="50%" colspan="3">&nbsp;
			<input type="radio" name="priceItemType" onclick="selectPriceItem()" value="<%=AppConstant.PRICE_ITEM_TYPE_FOB_SHANGHAI%>" <%if(null != pidetail.getPriceItemType() && AppConstant.PRICE_ITEM_TYPE_FOB_SHANGHAI == pidetail.getPriceItemType().intValue()){out.print("checked");}if(null == pidetail.getPriceItemType()){out.print("checked");}%>/><font color="blue">FOB SHANGHAI</font>&nbsp;
			<input type="radio" name="priceItemType" onclick="selectPriceItem()" value="<%=AppConstant.PRICE_ITEM_TYPE_FOB_NINGBO%>" <%if(null != pidetail.getPriceItemType() && AppConstant.PRICE_ITEM_TYPE_FOB_NINGBO == pidetail.getPriceItemType().intValue()){out.print("checked");}%>/><font color="blue">FOB NINGBO</font>&nbsp;
			<input type="radio" name="priceItemType" onclick="selectPriceItem()" value="<%=AppConstant.PRICE_ITEM_TYPE_CIF%>" <%if(null != pidetail.getPriceItemType() && AppConstant.PRICE_ITEM_TYPE_CIF == pidetail.getPriceItemType().intValue()){out.print("checked");}%>/><font color="blue">CIF</font>&nbsp;
			<input type="radio" name="priceItemType" onclick="selectPriceItem()" value="<%=AppConstant.PRICE_ITEM_TYPE_OTHER%>" <%if(null != pidetail.getPriceItemType() && AppConstant.PRICE_ITEM_TYPE_OTHER == pidetail.getPriceItemType().intValue()){out.print("checked");}%>/><font color="blue">OTHER</font>&nbsp;
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="newPiSource_TEXT">新单来源</td>
		<td width="30%">&nbsp;
			<select name="newPiSource" style="width:100px">
				<option value="">--请选择--</option>
				<%
					for(Iterator iter = sourceList.iterator();iter.hasNext();){
						SampleSource source = (SampleSource)iter.next();
				%>
				<option value="<%=source.getSourceId()%>" <%if(null != pidetail.getSource() && source.getSourceId().equals(pidetail.getSource().getSourceId())){out.print("selected");}%>><%=source.getSourceName()%></option>
				<%}%>
			</select>
		</td>
		<td class="table_label" width="20%" id="orderDis_TEXT">排列显示</td>
		<td width="30%">&nbsp;
			<input type="radio" name="orderDis" value="<%=AppConstant.ORDER_DIS_BY_SAMPLE%>" <%if(null != pidetail.getOrderDis() && AppConstant.ORDER_DIS_BY_SAMPLE == pidetail.getOrderDis().intValue()){out.print("checked");}if(null == pidetail.getOrderDis()){out.print("checked");}%>/>按款归并&nbsp;
			<input type="radio" name="orderDis" value="<%=AppConstant.ORDER_DIS_NOT_BY_SAMPLE%>" <%if(null != pidetail.getOrderDis() && AppConstant.ORDER_DIS_NOT_BY_SAMPLE == pidetail.getOrderDis().intValue()){out.print("checked");}%>/>不归并&nbsp;
		</td>
  </tr>
  <tr bgcolor="#ffffff">
    <td colspan="10" align="center"><input type="button" name="piproductDetailButton" class="button_common_5" value="销售产品细节" onclick="piproductDetail('${pidetail.piid}')" <%if(null == pidetail.getPiid()){out.print("disabled");}%>/>&nbsp;
    <input type="button" name="pifittingDetailButton" class="button_common_5" value="销售配件细节" onclick="pifittingDetail('${pidetail.piid}')" <%if(null == pidetail.getPiid()){out.print("disabled");}%>/></td>
  </tr>
  <tr class="InputFrameLine">
  	<td class="table_label" width="100%" colspan="4">
  		<table width="100%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
		  <tr> 
			<td width="100%" class="table_unfold_titlebar_small_bg" colspan="4">&nbsp;&nbsp;<b>运输信息</b></td>
		  </tr>
		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="transportType_TEXT">运输方式</td>
			<td width="80%" colspan="3">&nbsp;<input class="input" name="transportTypeText" type="text" value="${pidetail.transportTypeText}" style="width:300px" maxlength="100"/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
  		  	<td class="table_label" width="20%"></td>
	        <td width="80%" id="transportType_TEXT" colspan="3">
				<input type="radio" name="transportType" onclick="selectTransportType()" value="<%=AppConstant.TRANSPORT_TYPE_BY_SEA%>" <%if(null != pidetail.getTransportType() && AppConstant.TRANSPORT_TYPE_BY_SEA == pidetail.getTransportType().intValue()){out.print("checked");}if(null == pidetail.getTransportType()){out.print("checked");}%>/><font color="blue">BY SEA</font>&nbsp;
				<input type="radio" name="transportType" onclick="selectTransportType()" value="<%=AppConstant.TRANSPORT_TYPE_BY_AIR%>" <%if(null != pidetail.getTransportType() && AppConstant.TRANSPORT_TYPE_BY_AIR == pidetail.getTransportType().intValue()){out.print("checked");}%>/><font color="blue">BY AIR</font>&nbsp;
				<input type="radio" name="transportType" onclick="selectTransportType()" value="<%=AppConstant.TRANSPORT_TYPE_TBD%>" <%if(null != pidetail.getTransportType() && AppConstant.TRANSPORT_TYPE_TBD == pidetail.getTransportType().intValue()){out.print("checked");}%>/><font color="blue">TBD</font>&nbsp;
				<input type="radio" name="transportType" onclick="selectTransportType()" value="<%=AppConstant.TRANSPORT_TYPE_WAITING_FOR_YOUR_INF%>" <%if(null != pidetail.getTransportType() && AppConstant.TRANSPORT_TYPE_WAITING_FOR_YOUR_INF == pidetail.getTransportType().intValue()){out.print("checked");}%>/><font color="blue">WAITING FOR YOUR INFOMATION</font>&nbsp;
				<input type="radio" name="transportType" onclick="selectTransportType()" value="<%=AppConstant.TRANSPORT_TYPE_OTHER%>" <%if(null != pidetail.getTransportType() && AppConstant.TRANSPORT_TYPE_OTHER == pidetail.getTransportType().intValue()){out.print("checked");}%>/><font color="blue">OTHER</font>&nbsp;
			</td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="distination_TEXT">目的地</td>
			<td width="80%" colspan="3">&nbsp;<input class="input" name="distination" type="text" value="${pidetail.distination}" style="width:300px" maxlength="100"/></td>
  		  </tr>
		</table>
    </td>
  </tr>
  <tr class="InputFrameLine">
  	<td class="table_label" width="100%" colspan="4">
  		<table width="100%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
		  <tr> 
			<td width="100%" class="table_unfold_titlebar_small_bg" colspan="4">&nbsp;&nbsp;<b>PI备注信息</b></td>
		  </tr>
		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="memo_TEXT">PI备注</td>
			<td width="80%" colspan="3">&nbsp;
				<textarea name="memo" id="memo" cols="60" rows="4" style="width:90%" wrap="hard">${pidetail.memo}</textarea>
			</td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="memo1_TEXT">账户信息</td>
			<td width="80%" colspan="3">&nbsp;
				<textarea name="cardArea" id="cardArea" cols="60" rows="6" style="width:90%" wrap="hard" readonly></textarea>
			</td>
  		  </tr>
  		  <tr class="InputFrameLine">
  		  	<td class="table_label" width="20%" id="memo_TEXT"></td>
			<td width="80%" colspan="3">&nbsp;
				<input type="radio" name="card" onclick="setAccount()" value="<%=AppConstant.CARD_USD%>" <%if(null != pidetail.getCard() && AppConstant.CARD_USD.equals(pidetail.getCard())){out.print("checked");}%>/><font color="blue">美元账户</font>&nbsp;
				<input type="radio" name="card" onclick="setAccount()" value="<%=AppConstant.CARD_EUR%>" <%if(null != pidetail.getCard() && AppConstant.CARD_EUR.equals(pidetail.getCard())){out.print("checked");}%>/><font color="blue">欧元账户</font>&nbsp;
				<input type="radio" name="card" onclick="setAccount()" value="<%=AppConstant.CARD_RMB%>" <%if(null != pidetail.getCard() && AppConstant.CARD_RMB.equals(pidetail.getCard())){out.print("checked");}%>/><font color="blue">人民币账户</font>
			</td>
  		  </tr>
		</table>
    </td>
  </tr>
  <tr class="InputFrameLine">
  	<td class="table_label" width="100%" colspan="4">
  		<table width="100%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
		  <tr> 
			<td width="100%" class="table_unfold_titlebar_small_bg" colspan="4">&nbsp;&nbsp;<b>金额信息</b></td>
		  </tr>
		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="coinType_TEXT">合同币种</td>
			<td width="30%">&nbsp;
				<select name="coinType">
					<option value="">--请选择--</option>
					<option value="<%=AppConstant.COIN_TYPE_USD%>" <%if(null != pidetail.getCoinType() && AppConstant.COIN_TYPE_USD == pidetail.getCoinType().intValue()){out.print("selected");}%>>USD</option>
					<option value="<%=AppConstant.COIN_TYPE_RMB%>" <%if(null != pidetail.getCoinType() && AppConstant.COIN_TYPE_RMB == pidetail.getCoinType().intValue()){out.print("selected");}%>>RMB</option>
					<option value="<%=AppConstant.COIN_TYPE_EUR%>" <%if(null != pidetail.getCoinType() && AppConstant.COIN_TYPE_EUR == pidetail.getCoinType().intValue()){out.print("selected");}%>>EUR</option>
				</select>
			</td>
			<td class="table_label" width="20%" id="curExRate_TEXT">当前汇率</td>
			<td width="30%">&nbsp;<input class="input" name="curExRate" type="text" value="${pidetail.curExRate}" style="width:150px" maxlength="20"/>（比美元）</td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="totalSum_TEXT">总金额</td>
			<td width="30%">&nbsp;<input class="input" name="totalSum" type="text" value="<%=CommonUtil.format2Scale(pidetail.getTotalSum())%>" style="width:150px" maxlength="20" readOnly/></td>
			<td class="table_label" width="20%" id="totalQuantity_TEXT">总数量</td>
			<td width="30%">&nbsp;<input class="input" name="totalQuantity" type="text" value="${pidetail.totalQuantity}" style="width:150px" maxlength="20" readOnly/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="rePiSum_TEXT">翻单金额</td>
			<td width="30%">&nbsp;<input class="input" name="rePiSum" type="text" value="<%=CommonUtil.format2Scale(pidetail.getRePiSum())%>" style="width:150px" maxlength="20" readOnly/></td>
			<td class="table_label" width="20%" id="rePiQuantity_TEXT">翻单数量</td>
			<td width="30%">&nbsp;<input class="input" name="rePiQuantity" type="text" value="${pidetail.rePiQuantity}" style="width:150px" maxlength="20" readOnly/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="newPiSum_TEXT">新单金额</td>
			<td width="30%">&nbsp;<input class="input" name="newPiSum" type="text" value="<%=CommonUtil.format2Scale(pidetail.getNewPiSum())%>" style="width:150px" maxlength="20" readOnly/></td>
			<td class="table_label" width="20%" id="newPiQuantity_TEXT">新单数量</td>
			<td width="30%">&nbsp;<input class="input" name="newPiQuantity" type="text" value="${pidetail.newPiQuantity}" style="width:150px" maxlength="20" readOnly/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="otherSum_TEXT">其他费用</td>
			<td width="30%">&nbsp;<input class="input" name="otherSum" type="text" value="<%=CommonUtil.format2Scale(pidetail.getOtherSum())%>" style="width:150px" maxlength="20" readOnly/></td>
			<td class="table_label" width="20%" id="totalDiscount_TEXT">总体折扣</td>
			<td width="30%">&nbsp;<input class="input" name="totalDiscount" type="text" value="${pidetail.totalDiscount}" style="width:150px" maxlength="20"/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="sumDesc_TEXT">费用说明</td>
			<td width="30%" colspan="3">&nbsp;<input class="input" name="sumDesc" type="text" value="${pidetail.sumDesc}" style="width:300px" maxlength="100"/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="balanceDate_TEXT">结算日</td>
			<td width="30%" colspan="3">&nbsp;<input class="input" type="text" name="balanceDate" value="${pidetail.balanceDate}" onClick="setDay(this);"/></td>
  		  </tr>
  		  <tr class="InputFrameLine">
	        <td class="table_label" width="20%" id="balanceType_TEXT">结算方式</td>
			<td width="30%" colspan="3">&nbsp;<textarea name="balanceType" cols="60" rows="4" style="width:90%">${pidetail.balanceType}</textarea></td>
  		  </tr>
		</table>
    </td>
  </tr>
  <tr class="InputFrameLine">
  	<td class="table_label" width="100%" colspan="4">
  		<table width="100%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
		  <tr> 
			<td width="100%" class="table_unfold_titlebar_small_bg" colspan="4">&nbsp;&nbsp;<b>PI凭证附件</b></td>
		  </tr>
		  
		  <tr id="imagetr" class="InputFrameLine">
		  <%
		        if(null != pidetail.getAttachPath()&&!pidetail.getAttachPath().equals("")){
		  %>
		  		<td width="20%" align="right"><a href="javascript:deleteImage(<%=pidetail.getPiid()%>);">删除</a></td>
		        <td width="80%">
		        	<img name="image" src="${pageContext.request.contextPath}/<%=pidetail.getAttachPath()%>"/>
		        </td>
		   <%}%>
		  </tr>
		  
		  <tr class="InputFrameLine">
		  	<td class="table_label" width="20%" id="attach_TEXT">附件上传</td>
			<td width="30%" colspan="3">&nbsp;<input name="attach" type="file" class="input"/></td>
  		  </tr>
		</table>
    </td>
  </tr>
  <tr>
  	<td class="table_label" width="100%" colspan="4" align="right">制单员：<%=creatorName%></td>
  </tr>
</table>
</form>
</CENTER>
<%out.print(PermissionManager.getInstance().checkSubPermission("5001",request));%>
${message}
</body>
</html>
<script>
	setAccount();
</script>